home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir31
/
gusutils.zip
/
GUS.DOC
< prev
next >
Wrap
Text File
|
1994-02-08
|
11KB
|
304 lines
(****************************************************************************)
(* Module : GUS.DOC *)
(* Verion : 0.6ß *)
(* Date : Thu Feb 3, 1994 *)
(* Pascal : TP 7.0 *)
(****************************************************************************)
(* *)
(* NOTICE OF COPYRIGHT AND OWNERSHIP OF SOFTWARE: *)
(* *)
(* Copyright (C) 1993, 1994 by MESS Computer Services. *)
(* Portions Copyright (C) 1993, 1994 by TBP Electronics Ltd. *)
(* All rights reserved. *)
(* *)
(****************************************************************************)
(* MESS Computer Services V.O.F. MM MM EEEEEE SSSSS SSSSS *)
(* Jadestraat 54 M M M M E S S *)
(* 4817 JK Breda M M M EEEE SSSS SSSS *)
(* The Netherlands M M E S S *)
(* M M EEEEEE SSSSS SSSSS *)
(* Tel: +31-76 22 34 31 *)
(* Fax: +31-76 20 46 23 Many Efforts for Structured Systems *)
(* Email: appel@stack.urc.tue.nl *)
(****************************************************************************)
GusFind : Boolean
-------
At first it looks for the ULTRASND environment variable. If it
exists, the base address of the GUS is being read. If it doesn't
exist (or the address is invalid), it tries to detect the GUS
at very addres from 200h to 2A0h. Returns False when no GUS was
found, otherwise True.
GusBase (word)
-------
Is set to the GUS I/O base address (2x0), if no GUS board is found
or Mega-Em is active then GusBase is 0.
GusMemory (word)
---------
Contains the amount of GUS memory installed in Kb, i.e. 256, 512, 768,
or 1024. If no GUS board is found or there is no memory on the GUS
board installed or Mega-Em is active then GusMemory is 0.
GusEnvironment (string)
--------------
Contains the "ULTRASND" environment variable (or an empty string if it
doesn't exist).
GusVoices (byte)
---------
Contains the maximum number of active voices as set on the GUS.
GusDataConvert (boolean)
--------------
This variable is default set to False. The procedures GusWrite and
GusRead use this variable to convert the data to and from
2 complements. The GUS works only with data in 2 complements format
(signed) so if you want to play a sample in 1 complements format
(unsigned) you must set GusDataConvert to True, on the otherhand if
you want to play a sample in 2 complements format (signed) you must
set GusDataConvert to False.
2CMP (signed) -> GusDataConvert := False;
1CMP (unsigned) -> GusDataConvert := True;
GusData16Bits (boolean)
-------------
This variable is default set to False. The procedures GusWrite and
GusRead use this variable to convert the data to and fro 2 complements.
If GusData16Bits is set to True GusWrite and GusRead know that they
have to convert 16 Bits data.
8 Bits -> GusData16Bits := False;
16 Bits -> GusData16Bits := True;
MegaEm : Boolean
------
This function checks if Mega-Em is active, returns True when active,
otherwise False.
GusInit (VoicesMax : byte)
-------
This procedure resets the GF1 and initializes all the registers to
there default settings. The maximum number of active voices is set
to the new value given by VoicesMax.
You'll need this procedure in two cases:
1. You want to change the maximum number of active voices.
Let's say GusVoices is 14, but you need 24 voices. Simply
type GusInit (24).
2. You want to reset the GF1 because you are not sure if all the
registers are properly set. Simply type GusInit (GusVoices).
GusMixer (Output : ShortInt)
--------
You can change the GUS mixer at any time. The mixer can turn on the
line out, line in and mic in.
There are three constants defined:
LineOut = -1
LineIn = -2
MicIn = 4
So you can simply type GusMixer (LineOut+LineIn) and now the line in
and line out are enabled. If you want all mixer channels to be
disabled then you simply type GusMixer (0).
GusPoke (Address : LongInt; Value : Byte)
-------
Writes the value into the GUS memory. These are the maximum
addresses:
256 kb memory: 0 - 262144 ($3FFFF)
512 kb memory: 0 - 524288 ($7FFFF)
768 kb memory: 0 - 786432 ($BFFFF)
1024 kb memory: 0 - 1048576 ($FFFFF)
Note: The value is a byte! this byte is directly dumped into the
GUS memory (without any conversion).
GusPeek (Address : LongInt) : Byte
-------
Read a byte from the GUS memory. See also GusPoke.
GusWrite (Addres : LongInt; var Buffer; Count : Word)
--------
GusWrite writes Count or fewer bytes to the GUS memory from memory,
starting at the first byte occupied by Buffer to the GUS memory
pointed to by Address. Conversion is done according to the setting
of GusDataConvert (See also GusFind: GusDataConvert, GusData16Bits).
GusRead (Addres : LongInt; var Buffer; Count : Word)
--------
Reads from GUS memory to the memory buffer. See also GusWrite.
VoiceInit (Voice : Byte)
---------
The following procedures and functions affect only one voice. The
first parameter specifies the voice, it must be between 0 and
GusVoices - 1. For example, if you have called GusInit(14), the
voice number can range from 0 to 13.
VoiceInit set all parameters of a specific voice to there default
(zero) value.
VoiceBalance (Voice : Byte; Balance : Byte)
------------
You can change the balance at any time (panning effect). The
balance value ranges from 0 to 15, 0 being far left, 15 being far
right, and 7 is approximately middle.
There are three constants defined:
Left = 0
Middle = 7
Right = 15
So you can simply type VoiceBalance (0, Right) and now voice 0
sounds through the right speaker only.
VoiceVolume (Voice : Byte; Volume : Word)
-----------
Sets the volume (between 0 and 4095 = $FFF) for that voice. It's
not a linear volume, but a logarithmic one. Best way, you create
an array with the volumes you need.
$FFF = full volume
$EFF = half volume
$DFF = quarter volume
$CFF = eighth volume
$BFF = sixteenth volume etc.
The lowest hex digit can be used to fine tune the volume. $FF0 is
almost as loud as $FFF. You can change the volume at any time.
VoiceFreq (Voice : Byte; Freq : Word)
---------
Sets the Frequency (in bytes/second). If you have a 16 bits sample
you have to multiply the frequency by two to get the frequency in
bytes/second. You can change the frequency at any time.
VoiceMode (Voice : Byte; Mode : Byte)
---------
Sets various parameters. Mode is one or more of the following:
Bit8, Bit16 : selects 8 or 16 bit samples.
LoopOff, LoopOn : specifies whether to loop this voice.
UniDir, BiDir : unidirectional or bidirectional.
Forw, Backw : play the sample forward or backward.
For example, you can type VoiceMode (0,Bit8+LoopOn+UniDir+Forw). If
you omit any of the modes, the default is Bit8+LoopOff+UniDir+Forw.
VoiceSample (Voice : Byte; Start, LoopStart, LoopEnd : LongInt)
-----------
Specifies where the sample is located in the GUS memory. Start is
the start address of the sample (where the GUS starts playing). It
should be 32 bit aligned, i.e. bit 0 and 1 should be 0. LoopStart
and LoopEnd define the looping range. LoopStart MUST BE smaller
than LoopEnd. Note that the actual loop ends one byte before LoopEnd.
If you've disabled looping (see also VoiceMode), just set LoopStart
the same as Start (or any other value smaller than LoopEnd).
You can use VoiceSample at any time -- even while the voice is
playing.
VoiceStart (Voice : Byte)
----------
Starts playing the specified voice.
VoiceStop (Voice : Byte)
---------
Stops playing the specified voice.
VoiceActive (Voice : Byte) : Boolean
-----------
Returns False if the specified voice is stopped. Otherwise this
function return True, the voice is active.
GetVoiceLoc (Voice : Byte, Location : Byte) : LongInt
-----------
Get one of the GF1 pointers of the specified voice.
There are three constants defined:
Current = $8A
LoopStart = $82
LoopEnd = $84
So you can simply type GusVoiceLoc (0, Current) and the current
location of voice 0 will be returned.
RampRange (Voice : Byte; Lower, Upper : Word)
---------
Specify the lower and upper volume level of the volume ramp. These
are values between $000 and $FFF (see also VoiceVolume), but the
lower hex digit (lower 4 bits) is ignored.
Note: Lower must be less than Upper, even when ramping down.
RampRate (Voice : Byte; Scale, Rate : Byte)
--------
Sets the speed of the ramping. Scale must be between 0 and 3,
Rate must be between 0 and 63 (the less, the faster).
Scale increase or decrease volume by the Rate value per
----- -------------------------------------------------
0 1 Byte
1 8 Bytes
2 16 Bytes
3 512 Bytes
RampMode (Voice : Byte; Mode : Byte)
--------
Sets various ramp parameters. Mode is one or more of the following:
LoopOff, LoopOn: specifies whether to loop the volume ramp.
UniDir, BiDir : unidirectional or bidirectional.
Up, Down : slide up or down.
For a vibrato, you should usually type RampMode (Voice,LoopOn+BiDir),
up or down doesn't matter.
For a volume slide, you should type RampMode (Voice,LoopOff+UniDir+Up),
this will slide the volume up (from lower to upper level).
Simply replace "Up" by "Down" to slide the volume down (from upper to
lower level).
RampStart (Voice : Byte)
---------
Starts the volume ramping of the specified voice.
RampStop (Voice : byte)
--------
Stops the volume ramping of the specified voice.